import java.util.Scanner;

public class Text {


    String name = "uuhello";
    String password = "1234567";

    public void login(String name , String password){
        if(!this.name.equals(name)){
            throw new UserNameException("用户名输入错误！");
        }
        if(!this.password.equals(password)){
            throw new UserPasswordException("密码输入有误！！");
        }
        System.out.println("登陆成功！");
    }
    public static void main12(String[] args) {
        Scanner sc = new Scanner(System.in);
        String name = sc.nextLine();
        String password = sc.nextLine();

        Text text = new Text();
        try{
            text.login(name,password);
        }catch(UserNameException e){
            e.printStackTrace();
            System.out.println("用户名异常");
        }catch(UserPasswordException e){
            e.printStackTrace();
            System.out.println("密码输入错误");
        }finally{
            sc.close();
        }
    }

    public static void func5(int[] arr) throws CloneNotSupportedException{
        if(arr == null){
            throw new CloneNotSupportedException();
        }
    }

    public static void main11(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();


        try{
            int[] arr = null;
            System.out.println(arr.length);
        }catch (ArithmeticException e){
            e.printStackTrace();
            System.out.println("捕获 ArithmeticException 异常");
        }catch(Exception e){
            e.printStackTrace();
            System.out.println("出现异常！");
        }finally{
            sc.close();
            System.out.println("finally.......");
        }
        System.out.println(a);
        System.out.println("正常逻辑！");
    }

    public static void main10(String[] args) {
        try{
            int[] arr = {1,2,5,2,7,3};
            System.out.println(arr[10]);
        }catch (ArithmeticException e){
            e.printStackTrace();
            System.out.println("捕获 ArithmeticException 异常");

        }catch(NullPointerException e){
            e.printStackTrace();
            System.out.println("捕获 NullPointerException 异常");
        }finally{
            System.out.println("finally.......");
        }
        System.out.println("正常逻辑");
    }

    public static void main9(String[] args) {
        try{
            func5(null);
        }catch(CloneNotSupportedException e){
            e.printStackTrace();
            System.out.println("捕获 CloneNotSupportedException 异常,并实现处理异常的逻辑！");
        }
        System.out.println("正常逻辑~");
    }
    public static void main8(String[] args) throws  CloneNotSupportedException{
        func5(null);
    }
    public static int func4(int[] arr, int index){
        if(arr == null){
            throw new NullPointerException("数组为空指针！");
        }

        if(index < 0 || index >= arr.length){
            throw new ArrayIndexOutOfBoundsException("输入的数组下标越界了");
        }

        return arr[index];
    }

    public static void main7(String[] args) {
        int[] arr = {1,2,5,2,7,3};
        System.out.println(func4(arr,4));
        int[] arr1 = null;
        func4(arr1,12);
    }

        public static void func3(int[] a ){
            if (a == null){
                throw new NullPointerException("空指针！");
            }
        }
        public static void main6(String[] args) {
            func3(null);
        }

    public static void main5(String[] args) {
        String str = null;
        System.out.println(str.length());
    }
    public static void main4(String[] args) {
        int[] arrays = {1,2,3};
        System.out.println(arrays[3]);
    }
    public static void main3(String[] args) {
        System.out.println(10 / 0);
    }
    public static void func2(int[] a ){
        if (a == null){
            throw new NullPointerException();
        }
    }
    public static void main2(String[] args) {
        func2(null);
    }

    public static void func(){
        func();
    }
    public static void main1(String[] args) {
        func();
    }

}
